<template>
    <el-dialog
            title="优惠券列表"
            :visible.sync="dialogVisible"
            width="30%">
        <el-checkbox-group v-model="list" @change="handleSuccess">
            <el-checkbox v-for="bonuses in bonusesList" :label="bonuses.name" :key="bonuses.id">{{bonuses.name}}</el-checkbox>
        </el-checkbox-group>
        <span slot="footer" class="dialog-footer">
                <el-button @click="cancel">取 消</el-button>
                <el-button type="primary" @click="submit">确 定</el-button>
            </span>
    </el-dialog>
</template>

<script>
    export default {
        props:{
            bonusesList:Array
        },
        data(){
            return{
                dialogVisible:false,
                list:'',
                bonusesList:'',
                checkBonuse:''
            }
        },
        watch:{
            list(value){
                this.checkBonuse = value
            },
            checkBonuse(value) {
                console.log('文件列表',value)
                this.$emit('update:list', value);
            }
        },
        mounted(){
            this.getBonusesList()
        },
        methods:{
            getBonusesList(){
                axios
                    .get(`admin_bonus_categories/${id}`)
                    .then(res => res.data.data)
                    .then(res => {
                        console.log('数据', res)
                        this.bonusesList = res;
                    })
            },

        }
    }
</script>

<style scoped>

</style>